<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>Title</title>
</head>
<body>
<script>
    var i = 0;
    function foo(){
        console.log('i:'+ ++i);
        setTimeout(foo,50)
    }
    setTimeout(foo,50)


//    var t = setTimeout(foo,1000);
//    clearTimeout(t);
//    t = setTimeout(foo,1000);
//    clearTimeout(t);
</script>
</body>
</html>